package com.minibobbo.utilities.spe.movementmodules;

public class SpeMovementGliding extends SpeMovementModule {

	private float acceleration = 6;
	private float maxSpeed = 8;
	
	@Override
	public void updateMovement(float delta) {
		if(parent.d)
			parent.changeVector.y -= acceleration * delta;
		if(parent.u)
			parent.changeVector.y += acceleration * delta;
		if(parent.l)
			parent.changeVector.x -= acceleration * delta;
		if(parent.r)
			parent.changeVector.x += acceleration * delta;
		//If we are moving too fast, set the vector to the max speed.
		if(parent.changeVector.len() > maxSpeed) {
			float angle = parent.changeVector.angle();
			parent.changeVector.set(maxSpeed,0);
			parent.changeVector.rotate(angle);
			float angle2 = parent.changeVector.angle();
			
		}
		
		
	}

}
